<?php
namespace Manage\Controller;

use Think\Controller;


class LoginController extends Controller {


    /**
     * 登陆首页
     */
    public function index(){
        $this->display();
    }

    /**
     * 退出登陆
     */
    public function loginOut(){
        session(null);
        $this->redirect('/manage/login/index');
    }

    /**
     * 登陆
     */
    public function loginIn(){

        $username = htmlentities($_POST['username']);
        $password = md5($_POST['password']);
        $manage = M("pam_account");
        $post = ['login_name' => $username, 'login_password' => $password];
        $data = $manage->where($post)->find();
        if (!empty($data)) {
            session('manageInfo',$data);
            $this->redirect('/manage/index/index');
        } else {
            $this->error('用户名或密码错误!');
        }
    }

}